package org.example.medical.service.impl;

import org.example.medical.Mapper.DataSharingMapper;
import org.example.medical.entity.DataSharing;
import org.example.medical.service.DataSharingService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class DataSharingServiceImpl implements DataSharingService {
    @Autowired
    private DataSharingMapper dataSharingMapper;
    @Override
    public List<DataSharing> getDataSharings(String hospital, String department, int page, int size) {
        int offset = (page - 1) * size;
        return dataSharingMapper.selectByPage(hospital, department, offset, size);
    }

    @Override
    public void addDataSharing(DataSharing dataSharing) {
        dataSharingMapper.insertDataSharing(dataSharing);

    }

    @Override
    public void updateDataSharing(DataSharing dataSharing) {
        dataSharingMapper.updateDataSharing(dataSharing);

    }

    @Override
    public void softDeleteDataSharing(Long shareId) {
        dataSharingMapper.softDeleteDataSharing(shareId);

    }

    @Override
    public void batchSoftDeleteDataSharings(List<Long> shareIds) {
        dataSharingMapper.batchSoftDeleteDataSharings(shareIds);

    }
}
